<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_PilotLoadplan extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_IdPILOTLOADPLAN;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_PILOTTYPELOADIdPILOTTYPELOAD;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_DATELOAD;


    /**
     * Parent relation fk_PILOT_LOADPLAN_PILOT_TYPELOAD10
     *
     * @var Application_Model_PilotTypeload
     */
    protected $_PilotTypeload;


    /**
     * Dependent relation fk_PILOT_DATAJSON_PILOT_LOADPLAN1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotDatajson
     */
    protected $_PilotDatajson;

    /**
     * Dependent relation fk_PILOT_LOTDATA_PILOT_LOADPLAN1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotLotdata
     */
    protected $_PilotLotdata;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idPILOT_LOADPLAN'=>'IdPILOTLOADPLAN',
            'PILOT_TYPELOAD_idPILOT_TYPELOAD'=>'PILOTTYPELOADIdPILOTTYPELOAD',
            'DATELOAD'=>'DATELOAD',
        ));

        $this->setParentList(array(
            'FkPILOTLOADPLANPILOTTYPELOAD10'=> array(
                    'property' => 'PilotTypeload',
                    'table_name' => 'PilotTypeload',
                ),
        ));

        $this->setDependentList(array(
            'FkPILOTDATAJSONPILOTLOADPLAN1' => array(
                    'property' => 'PilotDatajson',
                    'table_name' => 'PilotDatajson',
                ),
            'FkPILOTLOTDATAPILOTLOADPLAN1' => array(
                    'property' => 'PilotLotdata',
                    'table_name' => 'PilotLotdata',
                ),
        ));
    }

    /**
     * Sets column idPILOT_LOADPLAN
     *
     * @param int $data
     * @return Application_Model_PilotLoadplan
     */
    public function setIdPILOTLOADPLAN($data)
    {
        $this->_IdPILOTLOADPLAN = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_LOADPLAN
     *
     * @return int
     */
    public function getIdPILOTLOADPLAN()
    {
        return $this->_IdPILOTLOADPLAN;
    }

    /**
     * Sets column PILOT_TYPELOAD_idPILOT_TYPELOAD
     *
     * @param string $data
     * @return Application_Model_PilotLoadplan
     */
    public function setPILOTTYPELOADIdPILOTTYPELOAD($data)
    {
        $this->_PILOTTYPELOADIdPILOTTYPELOAD = $data;
        return $this;
    }

    /**
     * Gets column PILOT_TYPELOAD_idPILOT_TYPELOAD
     *
     * @return string
     */
    public function getPILOTTYPELOADIdPILOTTYPELOAD()
    {
        return $this->_PILOTTYPELOADIdPILOTTYPELOAD;
    }

    /**
     * Sets column DATELOAD
     *
     * @param int $data
     * @return Application_Model_PilotLoadplan
     */
    public function setDATELOAD($data)
    {
        $this->_DATELOAD = $data;
        return $this;
    }

    /**
     * Gets column DATELOAD
     *
     * @return int
     */
    public function getDATELOAD()
    {
        return $this->_DATELOAD;
    }

    /**
     * Sets parent relation PILOTTYPELOADIdPILOTTYPELOAD
     *
     * @param Application_Model_PilotTypeload $data
     * @return Application_Model_PilotLoadplan
     */
    public function setPilotTypeload(Application_Model_PilotTypeload $data)
    {
        $this->_PilotTypeload = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_TYPELOAD'];
        }

        $this->setPILOTTYPELOADIdPILOTTYPELOAD($primary_key);

        return $this;
    }

    /**
     * Gets parent PILOTTYPELOADIdPILOTTYPELOAD
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotTypeload
     */
    public function getPilotTypeload($load = true)
    {
        if ($this->_PilotTypeload === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTLOADPLANPILOTTYPELOAD10', $this);
        }

        return $this->_PilotTypeload;
    }

    /**
     * Sets dependent relations fk_PILOT_DATAJSON_PILOT_LOADPLAN1
     *
     * @param array $data An array of Application_Model_PilotDatajson
     * @return Application_Model_PilotLoadplan
     */
    public function setPilotDatajson(array $data)
    {
        $this->_PilotDatajson = array();

        foreach ($data as $object) {
            $this->addPilotDatajson($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_DATAJSON_PILOT_LOADPLAN1
     *
     * @param Application_Model_PilotDatajson $data
     * @return Application_Model_PilotLoadplan
     */
    public function addPilotDatajson(Application_Model_PilotDatajson $data)
    {
        $this->_PilotDatajson[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_DATAJSON_PILOT_LOADPLAN1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotDatajson
     */
    public function getPilotDatajson($load = true)
    {
        if ($this->_PilotDatajson === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTDATAJSONPILOTLOADPLAN1', $this);
        }

        return $this->_PilotDatajson;
    }

    /**
     * Sets dependent relations fk_PILOT_LOTDATA_PILOT_LOADPLAN1
     *
     * @param array $data An array of Application_Model_PilotLotdata
     * @return Application_Model_PilotLoadplan
     */
    public function setPilotLotdata(array $data)
    {
        $this->_PilotLotdata = array();

        foreach ($data as $object) {
            $this->addPilotLotdata($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_LOTDATA_PILOT_LOADPLAN1
     *
     * @param Application_Model_PilotLotdata $data
     * @return Application_Model_PilotLoadplan
     */
    public function addPilotLotdata(Application_Model_PilotLotdata $data)
    {
        $this->_PilotLotdata[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_LOTDATA_PILOT_LOADPLAN1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotLotdata
     */
    public function getPilotLotdata($load = true)
    {
        if ($this->_PilotLotdata === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTLOTDATAPILOTLOADPLAN1', $this);
        }

        return $this->_PilotLotdata;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_PilotLoadplan
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_PilotLoadplan());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_PilotLoadplan::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdPILOTLOADPLAN() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idPILOT_LOADPLAN = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdPILOTLOADPLAN()));
    }
    
    
   
}
